<hr/>
<div class="row-fluid">
    <div class="span12">
        <a class="btn btn-info" id="btn_add" href="${request.contextPath}/system/module/detail"><i class="icon icon-plus"></i> 添加模块</a>
        <a class="btn btn-info" id="btn_refresh"><i class="icon icon-refresh"></i> 刷新</a>
    </div>
</div>
<div class="row-fluid">
    <div class="span12">
        <div class="widget-box">
            <div class="widget-title">
                <span class="icon"><i class="icon-table"></i></span>
                <h5>模块列表</h5>
            </div>
            <div class="widget-content nopadding">
                <table class="table table-bordered table-striped data-table">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>Module Name</th>
                        <th>Module Area</th>
                        <th>Module Href</th>
                        <th>Order Num</th>
                        <th>Show Menu</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <#list moduleList as module>
                        <tr id="tr_${module.moduleId}">
                            <td>${module_index + 1}</td>
                            <td><#list 1..module.level as i><#if i gt 1>&emsp;&emsp;</#if></#list>${module.moduleName}</td>
                            <td>${module.moduleArea}</td>
                            <td>${module.moduleHref}</td>
                            <td>${module.orderNum}</td>
                            <td>${module.showMenu}</td>
                            <td>
                                <a class="btn_edit" href="${request.contextPath}/system/module/detail?moduleId=${module.moduleId}"><i class="icon icon-pencil"></i></a>
                                <a class="btn_delete" href="#" data-key="${module.moduleId}"><i class="icon icon-remove"></i></a>
                            </td>
                        </tr>
                    </#list>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script src="${request.contextPath}/js/jquery-1.12.2.min.js"></script>
<script src="${request.contextPath}/js/jquery.dataTables.min.js"></script>
<script src="${request.contextPath}/js/sweetalert.min.js"></script>
<script type="text/javascript">

    $(function(){

        $("#btn_add").click(function(){
            loadPage($(this).attr("href"));
            return false;
        });

        $("td > .btn_edit").click(function(){
            loadPage($(this).attr("href"));
            return false;
        });

        $("td > .btn_delete").click(function(){
            var module = $(this).attr("data-key");
            swal({
                        title: "信息提示",
                        text: "真的要删了它？",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonText: "是的",
                        cancelButtonText: "算了",
                        closeOnConfirm: false
                    },
                    function(isConfirm){
                        if(isConfirm){
//                            deleteMember(memberId);
                        }
                    });
            return false;
        });
    });
</script>